﻿<%@ Page Title="" Language="C#" MasterPageFile="~/LTR/MlyLtrMaster.Master" AutoEventWireup="true" CodeBehind="AttachmentManager.aspx.cs" Inherits="MLY.LTR.AttachmentManager" %>
<asp:Content ID="Content1" ContentPlaceHolderID="titleHolder" runat="server">
    <style type="text/css">
#attachmentViewDiv
{
	 text-align:center !important;
	 vertical-align:middle;
     height:400px;
}
#spanUploading
{
	width:100%;
	text-align:center;
}

#backImg
{
	 cursor:pointer;
	 padding:4px;
	 border:solid 0px yellow;
	}
	
	#backImg:hover
    {
		 padding:0px;
	 border:solid 3px yellow;
	}
 
 
</style>
<script type="text/javascript">

    function doPostBack() { 
__doPostBack('__Page', 'MyCustomArgument');
    }

    function showUploadConfirmation() {
        alert("Upload finished!");
    }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <% if (_userValid == true)
   { %>
   <img onclick="history.back();" id="backImg" width="30" align="right" src="/Images/img_back.png" />
    <div id="attachmentViewDiv">
<asp:GridView ID="filesGridView" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" DataSourceID="filesDs" 
            onselectedindexchanged="filesGridView_SelectedIndexChanged" 
            onrowcommand="filesGridView_RowCommand">
    <Columns>
    <asp:TemplateField >
    <ItemTemplate>
    <ajaxToolKit:ConfirmButtonExtender runat="server" TargetControlID="delImgBtn" ConfirmText="<%$Dict:Attachment.FileName%>"></ajaxToolKit:ConfirmButtonExtender>
        <asp:ImageButton id="delImgBtn"  ImageUrl="~/Images/Cancel.gif" CommandName="fileDelete"
         CommandArgument='<%# Eval("Name") %>' runat="server" />
    </ItemTemplate>
    </asp:TemplateField>
   <asp:TemplateField >
    <ItemTemplate>
        <asp:ImageButton ID="ImageButton1" Width="20" ImageUrl="~/Images/down_arrow_inv.png" CommandName="fileDownload" CommandArgument='<%# Eval("Name") %>' runat="server" />
    </ItemTemplate>
    </asp:TemplateField>
   
        <asp:BoundField DataField="Name" HeaderText="<%$Dict:Attachment.FileName%>" 
            ReadOnly="True" SortExpression="Name" />
    </Columns>
</asp:GridView>
<h3><asp:Label runat="server" Text="<%$Dict:Attachment.FileUploadTitle%>"></asp:Label></h3>

<ajaxToolKit:AsyncFileUpload runat="server" ID="uploadTool" UploadingBackColor="Yellow" 
        OnClientUploadComplete="doPostBack" ThrobberID="spanUploading" 
            onuploadedcomplete="uploadTool_UploadedComplete" />&nbsp&nbsp


 <span id="spanUploading" runat="server" >
     <img src="../Images/AjaxLoadingIcon.gif" /></span></div>
    <asp:LinqDataSource ID="filesDs" runat="server" 
        ContextTypeName="MLY.Dal.lqKbmDataContext"  TableName="TableWorkOrders"
        onselecting="filesDs_Selecting" EnableDelete="True" EnableUpdate="True" 
        ondeleting="filesDs_Deleting">
       
    </asp:LinqDataSource>
    <%} %>
</asp:Content>
